package chapter14;

/**
 * @program: exercise
 * @description: 分析算法性能 ，输入不同规模问题,算法执行时间的差异
 * @author: 陈庆彪
 * @create: 2020-03-09 11:45
 **/
public class PerformanceTest {
    public static void main(String[] args) {
        getTime(100000000);
        getTime(1000000000);
    }

    private static void getTime(long n) {
        long startTime = System.currentTimeMillis();
        long k = 0;
        for (int i = 1; i <= n; i++) {
            k = k + 5;
        }
        long endTime = System.currentTimeMillis();
        System.out.println("execution time for n = " + n + " is " + (endTime - startTime) + " millisecond ");
    }
}
